﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chinesys.Entities;
using Chinesys.DataModel;

namespace Chinesys.Domain.DataMapper
{
    public static class UserAppInRoleDataMapper
    {
        public static UserAppInRoleEntity UserAppInRoleFromRowToEntity(UserAppInRole row)
        {
            UserAppInRoleEntity entity;
            if (row != null)
            {
                entity = new UserAppInRoleEntity();

                entity.Description = row.Description;
                entity.Id = row.Id;
                entity.RoleId = row.RoleId;
                entity.UserAppId = row.UserAppId;
                entity.CurrentState = RowState.Original;
            }
            else
                entity = null;

            return entity;
        }

        public static UserAppInRole UserAppInRoleFromEntityToRow(UserAppInRoleEntity entity)
        {
            UserAppInRole row;

            if (entity != null)
            {
                row = new UserAppInRole();

                row.Description = entity.Description;
                row.Id = entity.Id;
                row.RoleId = entity.RoleId;
                row.UserAppId = entity.UserAppId;
            }
            else
                row = null;

            return row;
        }
    }
}
